home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
bsrc_250.zip
/
B_SESSIO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-15
|
16KB
|
490 lines
/*--------------------------------------------------------------------------*/
/* */
/* */
/* ------------ Bit-Bucket Software, Co. */
/* \ 10001101 / Writers and Distributors of */
/* \ 011110 / Freely Available<tm> Software. */
/* \ 1011 / */
/* ------ */
/* */
/* (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
/* */
/* */
/* This module was written by Vince Perriello */
/* */
/* */
/* BinkleyTerm Mail Session Initiator */
/* */
/* */
/* For complete details of the licensing restrictions, please refer */
/* to the License agreement, which is published in its entirety in */
/* the MAKEFILE and BT.C, and also contained in the file LICENSE.250. */
/* */
/* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
/* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
/* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
/* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */
/* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */
/* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */
/* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */
/* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */
/* */
/* */
/* You can contact Bit Bucket Software Co. at any one of the following */
/* addresses: */
/* */
/* Bit Bucket Software Co. FidoNet 1:104/501, 1:343/491 */
/* P.O. Box 460398 AlterNet 7:491/0 */
/* Aurora, CO 80046 BBS-Net 86:2030/1 */
/* Internet f491.n343.z1.fidonet.org */
/* */
/* Please feel free to contact us at any time to share your comments about */
/* our software and/or licensing policies. */
/* */
/*--------------------------------------------------------------------------*/
/* Include this file before any other includes or defines! */
#include "includes.h"
extern int CallerSendSync (void);
extern int CalledRecvSync (void);
void b_session (int was_initiator)
{
int i;
ADDR tmp;
CURRENT = DEFAULT;
mail_finished = 0;
(void) time (&etm);
freq_accum.bytes = 0L;
freq_accum.files = 0;
freq_accum.time = 0L;
if (un_attended && fullscreen)
do_ready (MSG_TXT(M_READY_CONNECT));
/* Remove the old .REQ and .RSP files */
for (i = 0; i < 10; i++)
{
if (alias[i].Net == 0)
break;
tmp = alias[i];
/* For a point, massage the address to get the right .REQ filename */
if (tmp.Point != 0)
{
tmp.Node = tmp.Point;
tmp.Point = 0;
tmp.Net = (pvtnet > 0) ? (unsigned int) pvtnet : 0;
}
(void) sprintf (junk, "%s%s.REQ", CURRENT.sc_Inbound, Hex_Addr_Str (&tmp));
(void) unlink (junk);
(void) sprintf (junk, "%s.RSP", Hex_Addr_Str (&tmp));
(void) unlink (junk);
}
tmp.Zone = 0;
tmp.Net = 0;
tmp.Node = 0;
tmp.Point = 0;
tmp.Domain = NULL;
remote_capabilities = 0;
my_capabilities = (no_zapzed) ? 0 : (ZED_ZAPPER | ZED_ZIPPER);
my_capabilities |= (no_dietifna) ? 0 : Y_DIETIFNA;
if ((janus_baud >= cur_baud.rate_value) || (janus_OK))
my_capabilities |= DOES_IANUS;
(void) flag_file (SET_SESSION_FLAG, &called_addr, 0);
if (was_initiator)
{
/*
* OUTBOUND -- meaning call was made by us.
*/
last_type (1, &remote_addr);
if (Whack_CR () == 0)
{
retry_outbound:
switch (i = CallerSendSync())
{
case 1:
FTSC_sender (0);
break;
case 2:
if (YooHoo_Sender ())
{
if ((remote_capabilities & my_capabilities) == 0)
{
no_WaZOO_Session = 1;
status_line (MSG_TXT(M_NO_COMMON_PROTO));
goto retry_outbound;
}
WaZOO (1);
}
break;
default:
break;
} /* end switch */
}
}
else
{
/*
* INBOUND -- meaning we were connected to by another system.
*/
retry_inbound:
b_init ();
switch (i = CalledRecvSync())
{
case 1: /* ESCape or Timeout */
if (CARRIER && !mail_only)
{
last_type (3, &tmp);
(void) flag_file (CLEAR_SESSION_FLAG, &called_addr, 0);
BBSexit ();
}
break;
case 2: /* FTSC Netmail Session */
if (CARRIER)
{
tmp.Zone = (unsigned int) -1000;
last_type (2, &tmp);
tmp.Zone = 0;
++hist.mail_calls;
if (un_attended && fullscreen)
{
(void) sprintf (junk, "%d/%d", hist.bbs_calls, hist.mail_calls);
sb_move (history_hWnd, HIST_MAIL_ROW, HIST_COL);
sb_puts (history_BBS, junk);
sb_show ();
}
(void) FTSC_receiver (0);
}
break;
case 3: /* WaZOO Netmail Session*/
if (YooHoo_Receiver ())
{
if ((remote_capabilities & my_capabilities) == 0)
{
no_WaZOO_Session = 1;
status_line (MSG_TXT(M_NO_COMMON_PROTO));
goto retry_inbound;
}
last_type (1, &remote_addr);
++hist.mail_calls;
if (un_attended && fullscreen)
{
(void) sprintf (junk, "%d/%d", hist.bbs_calls, hist.mail_calls);
sb_move (history_hWnd, HIST_MAIL_ROW, HIST_COL);
sb_puts (history_BBS, junk);
sb_show ();
}
WaZOO (0); /* do WaZOO!!! */
}
break;
default:
if ((i >= 5) && (i < (5 + num_ext_mail))) /* See if ext mail */
{
if (CARRIER)
{
last_type (4, &tmp);
(void) flag_file (CLEAR_SESSION_FLAG, &called_addr, 0);
UUCPexit (lev_ext_mail[i-5]);
}
}
break;
} /* end switch */
} /* end